fix(pydantic-ai): Stop capturing tool execution spans when validation fails - #7448
Merged
alexander-alderman-webb merged 2 commits intoSep 10, 2026
Merged
Conversation
Contributor
Codecov Results 📊✅ 131905 passed | ⏭️ 7131 skipped | Total: 139036 | Pass Rate: 94.87% | Execution Time: 482m 21s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 2520 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## master #PR +/-##
==========================================
+ Coverage 90.20% 90.23% +0.03%
==========================================
Files 193 193 —
Lines 25788 25790 +2
Branches 9530 9532 +2
==========================================
+ Hits 23261 23270 +9
- Misses 2527 2520 -7
- Partials 1432 1433 +1Generated by Codecov Action |
alexander-alderman-webb
marked this pull request as ready for review
September 9, 2026 14:09
sentrivana
approved these changes
Sep 9, 2026
alexander-alderman-webb
deleted the
webb/pydantic-ai/no-span-validation-failure
branch
September 10, 2026 09:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Do not capture a tool execution span when the tool doesn't execute because the arguments are invalid.
The tool is never executed when validation fails, as
ToolHandlershort circuits by raising an exception in this case. See https://github.com/pydantic/pydantic-ai/blob/0ec8a5dcc9c30e82e91d63af20e5d92f1456fac5/pydantic_ai_slim/pydantic_ai/tool_manager.py#L977Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)